package com.project.personalfundmanager.shared.models;

import com.extjs.gxt.ui.client.data.BaseModel;
import com.project.personalfundmanager.client.common.Const;
import com.project.personalfundmanager.client.common.ModelHelper;
import com.project.personalfundmanager.client.listeners.Displayable;
import com.project.personalfundmanager.shared.DAOs.Section24DAO;

public class Section24Model extends BaseModel implements Displayable
{

	private static final long serialVersionUID = 1L;

	public Section24Model( Section24DAO dao )
	{
		setLetoutLoss( dao.getLetoutLoss() );
		setLetoutProfit( dao.getLetoutProfit() );
		setLoanInterest( dao.getLoanInterest() );
		setTotal( dao.getTotal() );
	}
	
	public static void copyToModel( Section24Model fromModel, Section24Model toModel)
	{
		toModel.setLetoutLoss( fromModel.getLetoutLoss() );
		toModel.setLetoutProfit( fromModel.getLetoutProfit() );
		toModel.setLoanInterest( fromModel.getLoanInterest() );
		toModel.setTotal( fromModel.getTotal() );
	}

	public Section24Model()
	{
		setDisplayString();
	}

	public void setDisplayString()
	{
		set( "displayString", "Sec 24 Exemption" );
	}

	public void setLetoutLoss( Integer letoutLoss )
	{
		set(Const.LET_OUT_LOSS, letoutLoss );
	}

	public Integer getLetoutLoss()
	{
		return ModelHelper.getNullSafeInt( get( Const.LET_OUT_LOSS ) );
	}

	public void setLetoutProfit( Integer letoutProfit )
	{
		set( Const.LET_OUT_PROFIT, letoutProfit );
	}

	public Integer getLetoutProfit()
	{
		return ModelHelper.getNullSafeInt( get( Const.LET_OUT_PROFIT ) );
	}

	public void setLoanInterest( Integer interestOnLoan )
	{
		set( Const.LOAN_INTEREST, interestOnLoan );
	}

	public Integer getLoanInterest()
	{
		return ModelHelper.getNullSafeInt( get( Const.LOAN_INTEREST ) );
	}

	public void setTotal( Integer total )
	{
		set( Const.SEC24_TOTAL, total );
	}

	public Integer getTotal()
	{
		return ModelHelper.getNullSafeInt( get( Const.SEC24_TOTAL ) );
	}
}
